summaryrefslogtreecommitdiff
path: root/app/[lng]/partners/(partners)/bid/page.tsx
blob: a09dec72c4386a7eacfb607d8a0ad28177bf7d3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { PartnersBiddingList } from '@/lib/bidding/vendor/partners-bidding-list'
import * as React from "react"
import { getServerSession } from 'next-auth'
import { authOptions } from "@/app/api/auth/[...nextauth]/route"
import { getBiddingListForPartners } from '@/lib/bidding/detail/service'
import { Shell } from '@/components/shell'
import { DataTableSkeleton } from '@/components/data-table/data-table-skeleton'

export default async function PartnersBidPage() {
  // 세션에서 companyId 가져오기
  const session = await getServerSession(authOptions)
  const companyId = session?.user?.companyId

  if (!companyId) {
    return (
      <div className="container mx-auto py-6">
        <div className="text-center">
          <h1 className="text-2xl font-bold text-destructive">회사 정보가 없습니다. 다시 로그인 해주세요.</h1>
        </div>
      </div>
    )
  }

  // 서버 사이드에서 입찰 목록 데이터 가져오기
  const promises = Promise.all([
    getBiddingListForPartners(companyId),
  ])

  return (
    <Shell className="gap-2">
    <div className="container mx-auto py-6 space-y-6">
      <div className="flex items-center justify-between">
        <div>
          <h1 className="text-3xl font-bold">입찰 참여</h1>
          <p className="text-muted-foreground mt-2">
            참여 가능한 입찰 목록을 확인하고 응찰하실 수 있습니다.
          </p>
        </div>
      </div>

      <React.Suspense
        fallback={
          <DataTableSkeleton
            columnCount={6}
            searchableColumnCount={1}
            filterableColumnCount={2}
            cellWidths={["10rem", "40rem", "12rem", "12rem", "8rem", "8rem"]}
            shrinkZero
          />
        }
      >        
      <PartnersBiddingList companyId={companyId} promises={promises} />
      </React.Suspense>
      </div>
    </Shell>
  )
}